.TH std::experimental::function 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::experimental::function \- std::experimental::function

.SH Synopsis
   Defined in header <experimental/functional>
   template< class >                            (library fundamentals TS)
   class function; /* undefined */
   template< class R, class... Args >           (library fundamentals TS)
   class function<R(Args...)>

   std::experimental::function is a modified version of std::function with support for
   type-erased allocators.

.SH Member types

   Type           Definition
                  std::experimental::erased_type    (library fundamentals TS)
   allocator_type                                   (until library fundamentals TS v3)
                  std::pmr::polymorphic_allocator<> (library fundamentals TS v3)

.SH Member functions

                                    constructs a new std::experimental::function
   constructor                      instance
                                    \fI(public member function)\fP
   operator=                        assigns a new target
                                    \fI(public member function)\fP
   swap                             swaps the contents
                                    \fI(public member function)\fP
   get_memory_resource              retrieves a pointer to the memory resource used by
   (removed in library fundamentals this object to allocate memory
   TS v3)                           \fI(public member function)\fP
                                    retrieves a type-erased
   get_allocator                    std::pmr::polymorphic_allocator used by this object
   (library fundamentals TS v3)     to allocate memory
                                    \fI(public member function)\fP

.SH Non-member functions

   std::experimental::swap(std::experimental::function) specializes the swap algorithm
                                                        \fI(function template)\fP
   operator==                                           compares an
   operator!=                                           std::experimental::function
   (removed in library fundamentals TS v3)              with nullptr
                                                        \fI(function template)\fP

.SH Helper classes

                                                    specializes the std::uses_allocator
   std::uses_allocator<std::experimental::function> type trait
   (removed in library fundamentals TS v3)          \fI(class template specialization)\fP


Members identical to std::function

.SH Member types

   Type                 Definition
   result_type          R
         Member types removed in Library Fundamental TS v3
   argument_type        T if sizeof...(Args) == 1 and T is the first and only type in
                        Args...
   first_argument_type  T1 if sizeof...(Args) == 2 and T1 is the first of the two types
                        in Args...
   second_argument_type T2 if sizeof...(Args) == 2 and T2 is the second of the two
                        types in Args...

   Member types argument_type, first_argument_type, and        (library fundamentals TS
   second_argument_type are removed, because the correponding  v3)
   member types of std::function are removed in C++20.

.SH Member functions

   destructor    destroys a std::function instance
                 \fI(public member function of std::function<R(Args...)>)\fP
   operator bool checks if a target is contained
                 \fI(public member function of std::function<R(Args...)>)\fP
   operator()    invokes the target
                 \fI(public member function of std::function<R(Args...)>)\fP
.SH Target access
   target_type   obtains the typeid of the stored target
                 \fI(public member function of std::function<R(Args...)>)\fP
   target        obtains a pointer to the stored target
                 \fI(public member function of std::function<R(Args...)>)\fP
